package template;

import java.util.concurrent.ConcurrentHashMap;

import org.springframework.stereotype.Service;
@Service
public abstract class AbstractPayOpenTemplate {
	
	protected Object getObject(Long id) {
		return id;
	}
	
	protected abstract void check(Object object);
	
	protected abstract void transform(Object object);
	
	protected abstract void assignment(Object object);
	
	public boolean entry(Long id) {
		
		Object obj = getObject(id);
		
		check(obj);
		
		transform(obj);
		
		assignment(obj);
		
		return false;
	}
	
	 /**
     * 策略
     * KEY为业务编码
     * VALUE为具体实现类
     */
    private static final ConcurrentHashMap<String, AbstractPayOpenTemplate> payOpenTemplate = new ConcurrentHashMap<>();

    
    public static void put(String name,AbstractPayOpenTemplate service) {
    	payOpenTemplate.put(name, service);
	}

	public static AbstractPayOpenTemplate get(String name) {
		return payOpenTemplate.get(name);
	}

}
